package com.elong.businesstravel.modules.member.adapter;

import java.util.List;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.elong.businesstravel.R;
import com.elong.businesstravel.base.baseactivity.BaseActivity;
import com.elong.businesstravel.entitys.AccountInfo;

/**
 * 使用记录
 * 
 * @author lenovo
 * 
 */
public class MemberGetUseBonusAdapter extends BaseAdapter {

	private Context mContext;
	private List<AccountInfo> mAccountInfos;

	public MemberGetUseBonusAdapter(Context context,
			List<AccountInfo> accountInfoList) {
		mContext = context;
		mAccountInfos = accountInfoList;
	}

	@Override
	public int getCount() {
		return mAccountInfos.size();
	}

	@Override
	public Object getItem(int arg0) {
		return mAccountInfos.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		return arg0;
	}

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {

		if (null == arg1) {
			arg1 = LayoutInflater.from(mContext).inflate(
					R.layout.adapter_member_get_use_bonus, null);
		}
		
		AccountInfo accountInfo = mAccountInfos.get(arg0);
		
		TextView orderNumTextView = (TextView)arg1.findViewById(R.id.orderNumTextView);
		orderNumTextView.setText(accountInfo.typeinfo + accountInfo.usedorderid);
		
		TextView dateTextView = (TextView)arg1.findViewById(R.id.dateTextView);
		dateTextView.setText(accountInfo.addtime);
		
		TextView flagTextView = (TextView)arg1.findViewById(R.id.flagTextView);
		flagTextView.setText(accountInfo.statusinfo);
		
		TextView moneyTextView = (TextView)arg1.findViewById(R.id.moneyTextView);
		moneyTextView.setText(accountInfo.usescore + "元");

		return arg1;
	}

}
